package com.aspose.cells;

class zakl {
   private int[] a;
   private int b;

   public zakl(int var1) {
      this.a = new int[var1];
      this.b = 0;
   }

   public zakl() {
      this.a = new int[8];
      this.b = 0;
   }

   public zakl(int[] var1, int var2) {
      this.b = var2;
      this.a = var1;
   }

   public void a(int var1) {
      if (this.b >= this.a.length) {
         int[] var2 = new int[this.b << 1];
         System.arraycopy(this.a, 0, var2, 0, this.a.length);
         this.a = var2;
      }

      this.a[this.b++] = var1;
   }

   public int a() {
      return this.b;
   }

   public int b(int var1) {
      return this.a[var1];
   }

   int b() {
      if (this.b == 0) {
         throw new CellsException(6, "No data in the stack");
      } else {
         int var1 = this.a[this.b - 1];
         this.c(-1);
         --this.b;
         return var1;
      }
   }

   void c() {
      this.b = 0;
      this.a = new int[8];
   }

   void c(int var1) {
      int var2 = this.b + var1;
      int[] var3;
      if (var2 > this.a.length) {
         var3 = new int[var2 * 2];
         System.arraycopy(this.a, 0, var3, 0, this.b);
         this.a = var3;
      } else if (var2 > 8 && var2 < this.a.length / 3) {
         var3 = new int[this.a.length / 2];
         System.arraycopy(this.a, 0, var3, 0, var2);
         this.a = var3;
      }

   }

   void a(int var1, int var2) {
      int var3 = var1 + var2;
      if (var3 < this.b) {
         System.arraycopy(this.a, var3, this.a, var1, this.b - var3);
      }

      this.b -= var2;
   }

   void b(int var1, int var2) {
      this.c(1);
      if (var1 < this.b) {
         System.arraycopy(this.a, var1, this.a, var1 + 1, this.b - var1);
      }

      this.a[var1] = var2;
      ++this.b;
   }

   void a(int var1, int[] var2, int var3, int var4) {
      this.c(var4);
      if (var1 < this.b) {
         System.arraycopy(this.a, var1, this.a, var1 + var4, this.b - var1);
      }

      System.arraycopy(var2, var3, this.a, var1, var4);
      this.b += var4;
   }

   int[] d() {
      return this.a;
   }
}
